<?php

namespace App\Http\Requests;

/**
 * 组织架构 request验证类
 */
class OrganizeRequest extends BaseRequest
{
    /**
     * 这个地方记得为 true, 默认为 false 会返回 403 未授权提示
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 验证规则
     * @return string[]
     */
    public function rules()
    {
        return [
            'company_id'      => 'required',
            'project_id'      => 'present',
            'department_id'   => 'present',
            'part_company_id' => 'present',
        ];
    }

    /**
     * 验证不通过提示
     * @return string[]
     */
    public function messages()
    {
        return [
            'company_id.required'     => '请填写公司id，不可为空',
            'project_id.present'      => '请填写项目id，可为空',
            'department_id.present'   => '请填写部门id，可为空',
            'part_company_id.present' => '请填写参建单位id，可为空'
        ];
    }

}
